package com.powernode.service.impl;

import com.powernode.constant.Constants;
import com.powernode.entity.Orders;
import com.powernode.service.OrdersService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 *
 */
@Service
@Slf4j
public class OrdersServiceImpl implements OrdersService {

    @Resource
    private RedisTemplate redisTemplate;

    @Override
    public Orders selectSeckillReturn(Integer id, Integer userId) {
        log.info("从redis中查询 订单数据");
        String key = Constants.REDIS_RESULT + id + ":" + userId;
        return (Orders) redisTemplate.opsForValue().get(key);
    }
}
